package com.huwaiwai.jvm.d20200713;

/**
 * @author 歪大哥😁
 * @date 2020-07-13.
 */
public class VolatileTest {

    private volatile int i;

    public synchronized int getI() {
        return i;
    }

    public synchronized void setI(int i) {
        this.i = i;
    }

    public static void main(String[] args) {
        VolatileTest v = new VolatileTest();
        v.setI(9);
        int i = v.getI();
        System.out.println(i);

        int i1 = 1;
        int i2 = 1 << 1;
        int i3 = 1 << 2;
        int i4 = 1 << 3;
        int ia = i1 | i2 | i3;
        System.out.println(ia);
        System.out.println((ia & i1) == i1);
        System.out.println((ia & i2) == i2);
        System.out.println((ia & i3) == i3);
        System.out.println((ia & i4) == i4);


    }
}
